﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace RiskMan.DataClass.AlfaDirectFolder
{
    /// <summary>
    /// ТАБЛИЦА «ACCOUNTS» - СПРАВОЧНИК СЧЕТОВ
    /// Ключевое поле: treaty
    /// </summary>
    public class Accounts : INotifyPropertyChanged
    {
        #region Private

        private int _treaty;
        private string _fullName;
        private int _iLastUpdate;
        private double _strartMargin;
        private double _msgMargin;
        private double _minMargin;



        #endregion

        #region Public

        /// <summary>
        /// Номер счета.
        /// </summary>
        public int Treaty
        {
            get { return _treaty; }
            set
            {
                if (_treaty != value)
                    _treaty = value;

                RaisePropertyChanged("Treaty");
            }
        }
        /// <summary>
        /// Полное название счета.
        /// </summary>
        public string FullName
        {
            get { return _fullName; }
            set
            {
                if (_fullName != value)
                    _fullName = value;

                RaisePropertyChanged("FullName");
            }
        }
        /// <summary>
        /// Временная метка последнего обновления.
        /// </summary>
        public int ILastUpdate
        {
            get { return _iLastUpdate; }
            set
            {
                if (_iLastUpdate != value)
                    _iLastUpdate = value;

                RaisePropertyChanged("ILastUpdate");
            }
        }
        /// <summary>
        /// Начальный уровень маржи.
        /// </summary>
        public double StrartMargin
        {
            get { return _strartMargin; }
            set
            {
                if (_strartMargin != value)
                    _strartMargin = value;

                RaisePropertyChanged("StrartMargin");
            }
        }
        /// <summary>
        /// Уведомительный уровень маржи.
        /// </summary>
        public double MsgMargin
        {
            get { return _msgMargin; }
            set
            {
                if (_msgMargin != value)
                    _msgMargin = value;

                RaisePropertyChanged("MsgMargin");
            }
        }
        /// <summary>
        /// Критический уровень маржи.
        /// </summary>
        public double MinMargin
        {
            get { return _minMargin; }
            set
            {
                if (_minMargin != value)
                    _minMargin = value;

                RaisePropertyChanged("MinMargin");
            }
        }

        #endregion

        #region event PropertyChangedEventHandler

        public event PropertyChangedEventHandler PropertyChanged;

        protected void RaisePropertyChanged(string propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        #endregion
    }
}
